package com.yizhu.zczy.project.controller;

import java.util.Arrays;
import java.util.Map;


import com.yizhu.zczy.common.utils.PageUtils;
import com.yizhu.zczy.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.yizhu.zczy.project.entity.ItemFinancingEntity;
import com.yizhu.zczy.project.service.ItemFinancingService;




/**
 * 项目融资详情
 *
 * @author guoyz
 * @email guoyz@mail.com
 * @date 2021-06-24 17:33:48
 */
@RestController
@RequestMapping("project/itemfinancing")
public class ItemFinancingController {
    @Autowired
    private ItemFinancingService itemFinancingService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("project:itemfinancing:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = itemFinancingService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("project:itemfinancing:info")
    public R info(@PathVariable("id") Integer id){
		ItemFinancingEntity itemFinancing = itemFinancingService.getById(id);

        return R.ok().put("itemFinancing", itemFinancing);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("project:itemfinancing:save")
    public R save(@RequestBody ItemFinancingEntity itemFinancing){
		itemFinancingService.save(itemFinancing);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("project:itemfinancing:update")
    public R update(@RequestBody ItemFinancingEntity itemFinancing){
		itemFinancingService.updateById(itemFinancing);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("project:itemfinancing:delete")
    public R delete(@RequestBody Integer[] ids){
		itemFinancingService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
